home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 25
/
Aminet 25 (1998)(GTI - Schatztruhe)[!][Jun 1998].iso
/
Aminet
/
util
/
pack
/
xpk_Source.lha
/
xpk_Source
/
libraries
/
FAST
/
xpkFAST.a
< prev
next >
Wrap
Text File
|
1998-04-04
|
5KB
|
156 lines
INCLUDE AINCLUDE:IncDirs.i *sets all includedirs, needed for my ASM
INCLUDE FAST/xpkLibFAST.i
include "xpk/xpk.i"
include "xpk/xpksub.i"
INCLUDE "exec/memory.i"
INCLUDE FAST/compress.a
INCLUDE FAST/compress2.a
INCLUDE FAST/decompress.a
_LVOXpksPackFree EQU -42
; XREF compress_fast
; XREF compress_slow
; XREF decompress
PACKMEM_FAST equ $10000
PACKMEM_SLOW equ $44000
UNPACKMEM equ 0
_XpksPackChunk:
movem.l d2/a2/a3/a5/a6,-(a7)
move.l a0,a5 ; xparams
move.l #PACKMEM_FAST,d0
lea.l compress_fast(pc),a3
moveq #80,d1
cmp.l xsp_Mode(a5),d1
bcs.s IsFast
move.l #PACKMEM_SLOW,d0
lea.l compress_slow(pc),a3
IsFast:
tst.l xsp_Sub(a5) ;Is there some memory allocated?
beq.s AllocPackMem
cmp.l xsp_Sub+4(a5),d0 ; Is the size right?
beq.s packMemOK
jsr _LVOXpksPackFree(a6) ; Free currently allocated memory.
AllocPackMem:
move.l d0,xsp_Sub+4(a5)
moveq #XPKERR_NOMEM,d2
move.l #MEMF_PUBLIC,d1
move.l 4.W,a6
jsr _LVOAllocMem(A6)
move.l d0,xsp_Sub(a5)
beq.s endPackChunk
packMemOK:
moveq.l #XPKERR_EXPANSION,d2
move.l xsp_InBuf(a5),a0 ;a0:=InBuf
move.l xsp_OutBuf(a5),a1 ;a1:=OutBuf
move.l xsp_Sub(a5),a2 ;a2:=Hash
move.l xsp_InLen(a5),d0 ;d0:=InLen
moveq.l #90,d1
jsr (a3) ; call the compressor.
tst.l d0
beq.s endPackChunk
move.l d0,xsp_OutLen(a5) ;Fill in Final output length XpkSubParams
moveq #XPKERR_OK,d2
endPackChunk:
move.l d2,d0
movem.l (sp)+,d2/a2/a3/a5/a6
rts
_XpksPackFree:
move.l a6,-(a7)
move.l xsp_Sub(a0),d1
beq.s packFreeEnd
move.l d1,a1
clr.l xsp_Sub(a0)
move.l xsp_Sub+4(a0),d0 ; currently allocated amount.
move.l 4.W,a6
clr.l xsp_Sub+4(a0)
jsr _LVOFreeMem(A6)
packFreeEnd:
moveq #XPKERR_OK,d0
move.l (a7)+,a6
rts
_XpksUnpackChunk:
move.l xsp_OutBuf(a0),a1
move.l xsp_InLen(a0),d0
move.l xsp_InBuf(a0),a0
bsr decompress
moveq.l #XPKERR_OK,d0
rts
_XpksPackerInfo:
lea FastInfo(pc),a0
move.l a0,d0
rts
; --- Static Data --------
FastInfo:
dc.w 1 ;xi_XpkInfoVersion:Version number of this structure
dc.w VERSION ;xi_LibVersion : The version of this sublibrary
dc.w 2 ;xi_MasterVersion: The required master lib version
dc.w 0 ;xi_ModesVersion : Longword align
dc.l FastName ;xi_Name : Brief name of the packer
dc.l LongName ;xi_LongName : Full name of the packer
dc.l Description ;xi_Description : One line description of packer
dc.b 'FAST' ;xi_ID : ID the packer goes by (XPK format)
;xi_Flags : Defined below
dc.l XPKIF_PK_CHUNK|XPKIF_UP_CHUNK|XPKIF_MODES
dc.l $7FFFFFFF ;xi_MaxPkInChunk : Max input chunk size for packing
dc.l 0 ;xi_MinPkInChunk : Min input chunk size for packing
dc.l $10000 ;xi_DefPkInChunk : Default packing chunk size
dc.l PackMsg ;xi_PackMsg : Packing message, present tense
dc.l UnpackMsg ;xi_UnpackMsg : Unpacking message, present tense
dc.l PackedMsg ;xi_PackedMsg : Packing message, past tense
dc.l UnpackedMsg ;xi_UnpackedMsg : Unpacking message, past tense
dc.w 50 ;xi_DefMode : Default mode number
dc.w 0 ;xi_Pad : for future use
dc.l Modes ;xi_Modes : Array of compression modes
dc.l 0,0,0,0,0,0 ;xi_Reserved,6*4 : Future expansion - set to zero
FastName: dc.b 'fasTcinator',0
LongName: dc.b 'FAST alias WOOP or LZRW++',0
Description: dc.b 'LZ77-family, windowsize: 4095, no quotecount, 2 streams',0
PackMsg: dc.b 'tieing',0
PackedMsg: dc.b 'compressed',0
UnpackMsg: dc.b 'untieing',0
UnpackedMsg: dc.b 'decompressed',0
EVEN
Modes:
dc.l Crawling ;xm_Next : Chain to next descriptor for ModeDesc list
dc.l 79 ;xm_Upto : Maximum efficiency handled by this mode.
;xm_Flags : Defined below
dc.l XPKMF_A3000SPEED
dc.l PACKMEM_FAST ;xm_PackMemory : Extra memory required during packing
dc.l UNPACKMEM ;xm_UnpackMemory : Extra memory during unpacking
dc.l 428 ;xm_PackSpeed : Approx packing speed in K per second
dc.l 1055 ;xm_UnpackSpeed : Approx unpacking speed in K per second
dc.w 327 ;xm_Ratio : CF in 0.1% for AmigaVision executable
dc.w 0 ;xm_ChunkSize : Desired chunk size in K (!!) for this mode
dc.b 'speedy',0,0,0,0 ;xm_Description,10:8 character mode description
Crawling:
dc.l 0 ;xm_Next : Chain to next descriptor for ModeDesc list
dc.l 100 ;xm_Upto : Maximum efficiency handled by this mode.
;xm_Flags : Defined below
dc.l XPKMF_A3000SPEED
dc.l PACKMEM_SLOW ;xm_PackMemory : Extra memory required during packing
dc.l UNPACKMEM ;xm_UnpackMemory : Extra memory during unpacking
dc.l 70 ;xm_PackSpeed : Approx packing speed in K per second
dc.l 1096 ;xm_UnpackSpeed : Approx unpacking speed in K per second
dc.w 393 ;xm_Ratio : CF in 0.1% for AmigaVision executable
dc.w 0 ;xm_ChunkSize : Desired chunk size in K (!!) for this mode
dc.b 'crawling',0,0 ;xm_Description,10:8 character mode description
END